# interview\dingtalk.py
from dingtalkchatbot.chatbot import DingtalkChatbot
from django.conf import settings


def send(message, at_mobile=None):
    if at_mobile is None:
        at_mobile = []
    # 引用 settings 里面配置的钉钉群消息通知的 WebHook 地址
    web_hook = settings.DINGTALK_WEB_HOOK

    # 初始化机器人小丁
    # 方式一：
    ding_talk = DingtalkChatbot(web_hook)
    # 方式二：
    # ding_talk = DingtalkChatbot(web_hook, secret=secret)

    # Text消息@所有人
    ding_talk.send_text(msg=f"面试通知：{message}", at_mobiles=at_mobile)
